import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonValue


enum class PaidType(private val value: Int) {
    WECHAT(0b0001),
    ALIPAY(0b0010),
    WECHAT_OR_ALIPAY(0b0011);

    @JsonValue
    fun getValue() = value

    companion object {
        @JsonCreator
        fun findEnum(v: Int) = values().find { it.getValue() == v } ?: throw Exception("incorrect enum value $v")

        @JsonCreator
        fun forValue(v: String) = findEnum(v.toInt())
    }
}